#!/bin/sh
#
# Taken from Alpine Linux and heavily
# modified to be shellcheck compliant.

while getopts "nNvXvf:C:r:" _; do :; done
shift "$((OPTIND - 1))"

[ "$#" -gt 0 ] && scanelf -qS "$@" | 
    
while read -r SONAME FILE; do
    case $FILE in
        /lib/*|/usr/lib/*|/usr/local/lib/*) ;;

        *) [ -h "$LINK" ] || [ ! -e "$LINK" ] && 
            ln -sf "${FILE##*/}" "${FILE%/*}/$SONAME"
    esac
done

return 0
